package com.ss.android.article.base.app.setting;

import android.content.SharedPreferences;
import android.support.annotation.Keep;
import android.text.TextUtils;

import com.bytedance.article.common.setting.ISettings;
import com.bytedance.article.common.setting.SettingKey;
import com.bytedance.article.common.setting.Transient;
import com.bytedance.common.utility.Logger;
import com.ss.android.update.UpdateHelper;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

@Keep
public class AppSettings implements ISettings {
    public static final int REFRESH_STRATEGY_NONE = 1;
    public static final int REFRESH_STRATEGY_STICKY_2000MS = 0;
    private static final String KEY_CHECK_SIGNATURE = "check_signature";
    @SettingKey
    public int mFeedCellSpacingChange;
    @SettingKey
    public int mPlayVideoInFeed;
    @SettingKey
    JSONArray mAllowedSchemeArray;
    @SettingKey
    int mDisableDelayFinish;
    @SettingKey
    int mDisableDetail302Check;
    @SettingKey
    int mDisableDetailFragmentPreload;
    @SettingKey
    int mDisableDetailWebViewAnimation;
    @SettingKey
    @Transient
    int mFirstRefreshTips;
    @SettingKey
    @Transient
    int mFirstRefreshTipsInterval;
    @SettingKey
    String mH5Settings;
    @SettingKey
    int mLargeImageDialogController;
    @SettingKey
    long mLaunchDelayTime;
    @SettingKey
    int mLockscreenEnable;
    @SettingKey
    int mPreloadFeed;
    @SettingKey
    int mRefreshStrategy;
    @SettingKey
    int mRequestMobileDelay;
    @SettingKey
    String mSafeDomainListString;
    @SettingKey
    int mShowRefreshButton;
    @SettingKey
    int mSingleImageGravityChange;
    @SettingKey
    int mSubChannelItem;
    @SettingKey
    int mTTEngineEnable;
    @SettingKey
    int mTTPlayerEnable;
    @SettingKey
    int mTTPlayerIPEnable;
    @SettingKey
    JSONArray mThirdPartyLoginConfig;
    @SettingKey
    long mUploadContactControl;
    @SettingKey
    int mVideoCellChange;
    @SettingKey
    int mWapMonitorSeconds;
    private List mSafeDomainList;

    public AppSettings() {

    }

    public boolean disableDetail302Check() {
        boolean v0 = this.mDisableDetail302Check != 0 ? true : false;
        return v0;
    }

    public boolean disableDetailFragmentPreload() {
        boolean v0 = this.mDisableDetailFragmentPreload != 0 ? true : false;
        return v0;
    }

    public boolean disableDetailWebViewAnimation() {
        boolean v0 = this.mDisableDetailWebViewAnimation != 0 ? true : false;
        return v0;
    }

    public boolean disabledDelayFinish() {
        boolean v0 = this.mDisableDelayFinish != 0 ? true : false;
        return v0;
    }

    public JSONArray getAllowedSchemeArray() {
        return this.mAllowedSchemeArray;
    }

    public int getFirstRefreshTipsInterval() {
        return this.mFirstRefreshTipsInterval;
    }

    public String getH5Settings() {
        return this.mH5Settings;
    }

    public boolean getLockScreenEnable() {
        boolean v0 = true;
        if (this.mLockscreenEnable != 1) {
            v0 = false;
        }

        return v0;
    }

    public int getRefreshStrategy() {
        return this.mRefreshStrategy;
    }

    public int getRequestMobileDelay() {
        return this.mRequestMobileDelay;
    }

    public List getSafeDomainList() {
        int v1_1;
        if (this.mSafeDomainList != null) {
            return mSafeDomainList;
        }

        ArrayList v0 = new ArrayList();
        this.mSafeDomainList = v0;
        try {
            JSONArray v2 = new JSONArray(this.mSafeDomainListString);
            v1_1 = 0;
            while (true) {
                label_9:
                if (v1_1 >= v2.length()) {
                    return v0;
                }

                if (!TextUtils.isEmpty(v2.optString(v1_1))) {
                    this.mSafeDomainList.add(v2.optString(v1_1));
                }

                ++v1_1;
                continue;
            }
        } catch (JSONException v1) {
            Logger.throwExceptionInDebug(v1);
            return v0;
        }
    }

    public JSONArray getThirdPartyLoginConfig() {
        return this.mThirdPartyLoginConfig;
    }

    public long getUploadContactControl() {
        return this.mUploadContactControl;
    }

    public int getWapMonitorSeconds() {
        return this.mWapMonitorSeconds;
    }

    public boolean isFeedCellSpacingChange() {
        boolean v0 = this.mFeedCellSpacingChange != 0 ? true : false;
        return v0;
    }

    public boolean isFirstRefreshTips() {
        boolean v0 = true;
        if (this.mFirstRefreshTips != 1) {
            v0 = false;
        }

        return v0;
    }

    public void setFirstRefreshTips(boolean arg2) {
        int v0 = arg2 ? 1 : 0;
        this.mFirstRefreshTips = v0;
    }

    public boolean isLargeImageDialogRepeatEnabled() {
        boolean v0 = this.mLargeImageDialogController != 0 ? true : false;
        return v0;
    }

    public boolean isMaxCellSpacingChange() {
        boolean v0 = true;
        if (!this.isFeedCellSpacingChange() || this.mFeedCellSpacingChange != 1) {
            v0 = false;
        }

        return v0;
    }

    public boolean isShowRefreshButton() {
        return false;
    }

    public boolean isShowSubChannel() {
        boolean v0 = true;
        if (this.mSubChannelItem != 1) {
            v0 = false;
        }

        return v0;
    }

    public boolean isSingleImageGravityChange() {
        boolean v0 = true;
        if (this.mSingleImageGravityChange != 1) {
            v0 = false;
        }

        return v0;
    }

    public boolean isTTEngineEnable() {
        return this.mTTEngineEnable != 0 ? true : false;
    }

    public boolean isTTPlayerEnable() {
        return this.mTTPlayerEnable != 0 ? true : false;
    }

    public boolean isTTPlayerIPEnable() {
        return this.mTTPlayerIPEnable != 0 ? true : false;
    }

    public boolean isVideoCellChange() {
        boolean v0 = true;
        if (this.mVideoCellChange != 1) {
            v0 = false;
        }

        return v0;
    }

    public void loadData(SharedPreferences arg1) {
    }

    public void saveData(SharedPreferences.Editor arg1) {
    }

    public boolean shouldPreloadFeed() {
        boolean v0 = true;
        if (this.mPreloadFeed != 1) {
            v0 = false;
        }
        return v0;
    }

    public boolean tryUpdateAppSetting(JSONObject arg4) {
        UpdateHelper.a = arg4.optInt("check_signature", -1) != 0;
        this.mSafeDomainList = null;
        return false;
    }
}

